package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.vo.AdminHomeCountVo;
import com.ruoyi.system.domain.vo.AdminHomehexinCountVo;
import com.ruoyi.system.domain.vo.HomeCountVo;
import com.ruoyi.system.domain.vo.web.WebFyDataVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.FyDataMapper;
import com.ruoyi.system.domain.FyData;
import com.ruoyi.system.service.IFyDataService;

/**
 * 资料Service业务层处理
 *
 * @author ruoyi
 * @date 2025-06-05
 */
@Service
public class FyDataServiceImpl implements IFyDataService
{
    @Autowired
    private FyDataMapper fyDataMapper;

    /**
     * 查询资料
     *
     * @param dataId 资料主键
     * @return 资料
     */
    @Override
    public FyData selectFyDataByDataId(Long dataId)
    {
        return fyDataMapper.selectFyDataByDataId(dataId);
    }

    @Override
    public HomeCountVo selectHomecount() {
        return fyDataMapper.selectHomecount();
    }

    /**
     * 查询资料列表
     *
     * @param fyData 资料
     * @return 资料
     */
    @Override
    public List<FyData> selectFyDataList(FyData fyData)
    {
        return fyDataMapper.selectFyDataList(fyData);
    }

    @Override
    public List<WebFyDataVo> selectwebDataList(Long dataType,String dataFormat,Long projectId,Long peopleId) {
        return fyDataMapper.selectwebDataList( dataType, dataFormat, projectId, peopleId);
    }

    @Override
    public List<WebFyDataVo> selectwebDataListproject(Long dataType, String dataFormat, Long projectId, Long peopleId) {
        return fyDataMapper.selectwebDataListproject( dataType, dataFormat, projectId, peopleId);
    }

    @Override
    public List<WebFyDataVo> selectwebDataListpeople(Long dataType, String dataFormat, Long projectId, Long peopleId) {
        return fyDataMapper.selectwebDataListpeople( dataType, dataFormat, projectId, peopleId);
    }
    @Override
    public List<WebFyDataVo> selectwebDataListpeopleshi(Long dataType, String dataFormat, Long projectId, Long peopleId) {
        return fyDataMapper.selectwebDataListpeopleshi( dataType, dataFormat, projectId, peopleId);
    }

    @Override
    public AdminHomeCountVo selectAdminHomecountShujuzonglan() {
        return fyDataMapper.selectAdminHomecountShujuzonglan();
    }
    @Override
    public AdminHomehexinCountVo selectAdminHomecountHexinShujuzonglan() {
        return fyDataMapper.selectAdminHomecountHexinShujuzonglan();
    }

    /**
     * 新增资料
     *
     * @param fyData 资料
     * @return 结果
     */
    @Override
    public int insertFyData(FyData fyData)
    {
        fyData.setIsDelete(0l);
        fyData.setCreateTime(DateUtils.getNowDate());
        return fyDataMapper.insertFyData(fyData);
    }

    /**
     * 修改资料
     *
     * @param fyData 资料
     * @return 结果
     */
    @Override
    public int updateFyData(FyData fyData)
    {
        fyData.setUpdateTime(DateUtils.getNowDate());
        return fyDataMapper.updateFyData(fyData);
    }

    /**
     * 批量删除资料
     *
     * @param dataIds 需要删除的资料主键
     * @return 结果
     */
    @Override
    public int deleteFyDataByDataIds(Long[] dataIds)
    {

        for (Long l:dataIds){
            FyData fyData=new FyData();
            fyData.setDataId(l);
            fyData.setIsDelete(1l);
            fyDataMapper.updateFyData(fyData);
        }
        return 1;
    }

    /**
     * 删除资料信息
     *
     * @param dataId 资料主键
     * @return 结果
     */
    @Override
    public int deleteFyDataByDataId(Long dataId)
    {
        return fyDataMapper.deleteFyDataByDataId(dataId);
    }
}
